from django.contrib import admin
from app.dish_recognition.models import IMG
from django.utils.safestring import mark_safe
from import_export.admin import ImportExportModelAdmin
from .models import IMG


'''
将模型注册到admin后台中
'''
admin.site.site_header = '智能菜谱后台管理'
admin.site.site_title  = '智能菜谱后台管理'



# #识别图片模型的管理器
# class IMGAdmin(admin.ModelAdmin):
#     list_display = ('name','img','image_data')
#     readonly_fields = ("image_data",) #必须加这行 否则访问编辑页面会报错


class IMGAdmin(ImportExportModelAdmin):
    list_display = ('name', 'image_data')
    readonly_fields = ("image_data",)  # 必须加这行 否则访问编辑页面会报错
    list_per_page = 10


#在admin中注册绑定
admin.site.register(IMG,IMGAdmin)


